<?php
namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class UserController extends Controller
{
    /**
     * 为指定用户显示详情
     *
     * @param int $id
     * @return Response
     * @author LaravelAcademy.org
     */
    public function show($id)
    {


    	
    	$users = DB::select('select * from fly_user');


    	// var_dump($users);

    	// DB::insert('insert into users (id, name) values (?, ?)', [1, '学院君']);
    	// 
    	 $users = DB::table('fly_user')->get();

    	 $users = DB::table('fly_user')->where('sex', '男')->first();


    	 // $users = DB::table('users')
      //       ->join('contacts', 'users.id', '=', 'contacts.user_id')
      //       ->join('orders', 'users.id', '=', 'orders.user_id')
      //       ->select('users.*', 'contacts.phone', 'orders.price')
      //       ->get();


    	 // var_dump($users);


    	 $users = User::all();

    	 foreach ($users as $user) {
		    echo $user->nickname;
		}
		// session(['key' => 'value']);
        





        return view('user.show',['title'=>'xuebingsi']);
    }
}